﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

/// <summary>
/// 对cookie的操作
/// </summary>
public static class encryption
{
    private const string pwSalt = "AlrySqloPe2Mh784QQwG6jRAfkdPpDa90JOi";//密码加密随机串

    /// <summary>
    /// 密码异或加密， 第一次异或加密， 第二次异或解密
    /// </summary>
    /// <param name="password">密码</param>
    /// <param name="model">异或字符串</param>
    /// <returns></returns>
    public static string XOR(string password)
    {
        char[] tempPsw = password.ToCharArray();
        char[] modelC = pwSalt.ToCharArray();
        StringBuilder secretPsw = new StringBuilder();
        for (int i = 0; i < tempPsw.Length; i++)
        {
            char c = (char)(tempPsw[i] ^ modelC[i]);
            secretPsw.Append(c);
        }
        return secretPsw.ToString();
    }
}
